﻿
Partial Class WebForm_MainForPerson
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Me.Master.SiteMapPath.Provider = SiteMap.Providers("PersonSiteMapProvider")
            Me.BindData()
        End If
    End Sub

    Protected Sub SearchBulletin1_Loaded(ByVal source As Object, ByVal e As System.EventArgs) Handles SearchBulletin1.Loaded
        Me.SearchBulletin1.BindGV(My.UserType.Person)
    End Sub
End Class

Partial Class WebForm_MainForPerson
    Private Sub BindData()
        Me.BindGVToDo()
    End Sub

    Private Sub BindGVToDo()
        Dim dat As New clsData
        Dim sql As New MyStringBuilder

        sql.AppendFormat("select ")
        sql.AppendFormat("'[志工審核]' as col1 ")
        sql.AppendFormat(",'' as col2 ")

        sql.AppendFormat("union all select ")
        sql.AppendFormat("'待招募審核志工人數:' as col1 ")
        sql.AppendFormat(",cast(count(*) as nvarchar(10)) as col2 ")
        sql.AppendFormat("from VolunteerDistinctView v ")
        sql.AppendFormat("where v.Active = '{0}' ", My.VolunteerStatus.Approving)

        sql.AppendFormat("union all select ")
        sql.AppendFormat("'待發放紀錄冊志工人數:' as col1 ")
        sql.AppendFormat(",cast(count(*) as nvarchar(10)) as col2 ")
        sql.AppendFormat("from VolunteerDistinctView v ")
        sql.AppendFormat("where v.Active = '{0}' ", My.VolunteerStatus.Approving)

        sql.AppendFormat("union all select ")
        sql.AppendFormat("'[志工服務]' as col1 ")
        sql.AppendFormat(",'' as col2 ")

        sql.AppendFormat("union all select ")
        sql.AppendFormat("'待處理髒亂點數量:' as col1 ")
        sql.AppendFormat(",cast(count(*) as nvarchar(10)) as col2 ")
        sql.AppendFormat("from VolunteerDistinctView v ")
        sql.AppendFormat("where v.Active = '{0}' ", My.VolunteerStatus.Approving)

        sql.AppendFormat("union all select ")
        sql.AppendFormat("'待發放榮譽卡志工人數:' as col1 ")
        sql.AppendFormat(",cast(count(*) as nvarchar(10)) as col2 ")
        sql.AppendFormat("from VolunteerDistinctView v ")
        sql.AppendFormat("where v.Active = '{0}' ", My.VolunteerStatus.Approving)

        Me.gvToDO.DataSource = dat.GetData(sql)
        Me.gvToDO.DataBind()

    End Sub
End Class